package com.wy.service;

import com.wy.dao.UserMapper;
import com.wy.pojo.User;
import com.wy.utils.MybatisUtils;
import org.apache.ibatis.session.SqlSession;

public class UserService {
    public User login(User u) {
        //1.获取SqlSession对象
        SqlSession sqlSession = MybatisUtils.getSqlSession();
        //2.获取接口的代理类对象
        UserMapper mapper = sqlSession.getMapper(UserMapper.class);
        //3.调用方法执行
        User user = mapper.login(u);
        //4.关闭sqlSession
        sqlSession.close();
        return user;
    }
}
